﻿using Microsoft.AspNetCore.Mvc;
using MiniFox.Infrastructure;
using MiniFox.Platform.Applications.Models;
using MiniFox.Utility;
using MiniFox.Web.Infrastructure;

namespace MiniFox.Platform.Applications.Web
{
    /// <summary>
    /// 
    /// </summary>
    [NoCache]
    public class AdministrationController : AuthorizedController<IAdministrationService>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response SetEnv([FromBody] EnvConfig envConfig)
        {
            this.Component.SetEnvironmentConfig(envConfig);
            return new();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Response<EnvConfig> GetEnv()
        {
            var envConfig = this.Component.GetEnvironmentConfig();
            return envConfig.CreateResponse();
        }
    }
}
